import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    params: data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: {token}
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

function list(params) {
  return request({
    url: '/user/list',
    method: 'get',
    params
  })
}

function save(data) {
  return request({
    url: '/user/user',
    method: 'post',
    data
  })
}

function update(data) {
  return request({
    url: '/user/user',
    method: 'put',
    data
  })
}

function remove(data) {
  return request({
    url: '/user/user',
    method: 'delete',
    data
  })
}

export default {
  list,
  save,
  update,
  remove
}
